package TUILayer;
import ControlLayer.*;
import java.util.Scanner;


/**
 * Write a description of class MainMenu here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MainMenu
{
    // instance variables - replace the example below with your own
    private Person personMenu=new Person();
    private DVD dvdMenu=new DVD();
    private Loan loan=new Loan();
    
    
    public MainMenu()
    {
       System.out.println("Group 1 2nd workshop.");
       System.out.println();
       mainMenuStart();
    }

    public void mainMenuStart()
   {
        boolean exit=false;
        while (!exit) //! means while exit not is true (that is: false)
        {
            int choise = writeMainMenu();
            switch (choise)
            {
                case 1:
                {
                       personMenu.menuAddressBook();
                       break;
                }
                case 2:
                {
                       dvdMenu.menuDVD();
                       break;
                }
                case 3:
                {
                       loan.menuLoan();
                       break;
                }
                case 4:
                {
                       writeEnd();
                       exit = true;
                       break;
                }
            
            }
            
           
          }// end else
       }//end else
    
    private int writeMainMenu()
    {
       Scanner keyboard = new Scanner(System.in);
       System.out.println("\f *** Main Menu ***");
       System.out.println(" (1)AddressBook");
       System.out.println(" (2)DVDregister");
       System.out.println(" (3)Loan");
       System.out.println(" (4)Close");
       System.out.print("\n Make your choise: ");
       int choise = keyboard.nextInt();
       return choise;
    }

    private void writeEnd()
    {
        System.out.println(" Bye bye!");
    }
}
